package com.burgeon.backend.SHOP.controller;

import com.burgeon.backend.SHOP.entity.Mail;
import com.burgeon.backend.SHOP.service.MailService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
@RequestMapping("shop/mail")
public class MailController extends BaseController{
    @Autowired
    private MailService mailService;

    @RequestMapping("find")
    public ResponseResult<List<String>> findMail(String oid){
        System.err.println("oid="+oid);
        List<String> data = mailService.FindExpress(oid);
        return new ResponseResult<List<String>>(SUCCESS,data);
    }

    @RequestMapping("type")
    public ResponseResult<List<Mail>> mailType(HttpSession session){
        String token = session.getAttribute("token").toString();
        List<Mail> data = mailService.GetMailType(token);
        return new ResponseResult<List<Mail>>(SUCCESS,data);
    }

}
